// 类
public class category {
    public static void main(String[] args) {
        Person p = new Person();
        p.getInfo("张三", 23);

        /*
         * 练习
         * 请给Person1类增加(String, int)的构造方法
         * */

        Person1 p1 = new Person1("小明", 15);
        System.out.println(p1.getName());
        System.out.println(p1.getAge());
    }

    static class Person {
        String name;
        int age;

        public void getInfo(String name, int age) {
            this.name = name;
            this.age = age;
            System.out.println(name + "的年龄是" + age);
        }
    }

    static class Person1 {
        private String name;
        private int age;

        public Person1(String name, int age) {
            this.name = name;
            this.age = age;
        }

        public String getName() {
            return name;
        }

        public int getAge() {
            return age;
        }
    }

}
